/**************************************************************************
 * @doc PIP
 * @module ifldtbl.h |  
 * Header file for the Field definition table.
 *
 * Product     :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   : Monique Brown
 * <nl>Notes       :
 *
 * @head3 PIP & ISO Functions |
 * @index | PIP
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 * 
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form 
 * or by any means whether electronic, mechanical, magnetic, optical, 
 * or otherwise, without the express prior written permission of VeriFone, Inc.
   
$Log: /SoftPay/SPK2SIM/Source/Include/ifldtbl.h $ 
--------------------------------------------------------------------------*/
#ifndef IFLDTBL
#define IFLDTBL

#ifdef PIP_DEFINED

#include <amexhost.h>
#include <isodefs.h>

/* ISO 8583 format specific informations */

typedef struct TagISO_DATA
{
	unsigned char szMsgTypeId[MTI_SIZE + 1];    /* Message Type */
	unsigned char pszField02[FIELD02_SIZE + 1];	/* Primary acct number */
	unsigned char pszField03[FIELD03_SIZE + 1]; /* Processing code */
	unsigned char pszField04[FIELD04_SIZE + 1]; /* Transaction amount */
	unsigned char pszField05[FIELD05_SIZE + 1]; /* Original Transaction amount */
	unsigned char pszField07[FIELD07_SIZE + 1]; /* Transaction Date and Time for Paymentech */
	unsigned char pszField08[FIELD08_SIZE + 1]; /* Amount, Cardholder Billing for Paymentech */
	unsigned char pszField11[FIELD11_SIZE + 1]; /* STAN */
	long lnField11;                                  /* STAN */
	unsigned char pszField12[FIELD12_SIZE + 1]; /* Transaction time */
	unsigned char pszField13[FIELD13_SIZE + 1]; /* Transaction date */
	unsigned char pszField14[FIELD14_SIZE + 1]; /* Expiration date */
	unsigned char pszField15[FIELD15_SIZE + 1]; /* Saritha_b1 Added as it was required in ETSL Application */
    unsigned char pszField17[FIELD17_SIZE + 1]; /* Batch Number */
    unsigned char pszField18[FIELD18_SIZE + 1]; /* Merchant Type */
	unsigned char pszField22[FIELD22_SIZE + 1]; /* POS Entry Mode */
	unsigned char pszField23[FIELD23_SIZE + 1]; /* Card sequence number */  // jrd 10212005
	unsigned char pszField24[FIELD24_SIZE + 1]; /* NII */
	unsigned char pszField25[FIELD25_SIZE + 1]; /* POS Condition Code */
	unsigned char pszField26[FIELD26_SIZE + 1]; /* New tran code */
	unsigned char pszField27[FIELD27_SIZE + 1]; /* Reference Number */
	unsigned char pszField28[FIELD28_SIZE + 1]; /* Transaction Type */
	unsigned char pszField30[FIELD30_SIZE + 1]; /* Original amount */
	unsigned char pszField31[FIELD31_SIZE + 1]; /* Acquirer Reference Info  */
	unsigned char pszField32[FIELD32_SIZE + 1]; /* Acquirer institution code */
	unsigned char pszField33[FIELD33_SIZE + 1]; /* Tax Amount */
	unsigned char pszField35[FIELD35_SIZE + 1]; /* Track 2 data */
	unsigned char pszField37[FIELD37_SIZE + 1]; /* Retrieval Ref Num */
	unsigned char pszField38[FIELD38_SIZE + 1]; /* Approval Code */
	unsigned char pszField39[FIELD39_SIZE + 1]; /* Response Code */
	unsigned char pszField41[FIELD41_SIZE + 1]; /* Terminal ID */
	unsigned char pszField42[FIELD42_SIZE + 1]; /* Card Acceptor ID */
	unsigned char pszField43[FIELD43_SIZE + 1]; /* System Information */
	unsigned char pszField44[FIELD44_SIZE + 1]; /* Additional Response */
	unsigned char pszField45[FIELD45_SIZE + 1]; /* Track 1 data */
	unsigned char pszField47[FIELD47_SIZE + 1]; /* Additional data */
	unsigned char pszField48[FIELD48_SIZE + 1]; /* Additional data */
	unsigned char pszField52[FIELD52_SIZE + 1]; /* PIN data */
	unsigned char pszField53[FIELD53_SIZE + 1]; /* Logon password */
	unsigned char pszField54[FIELD54_SIZE + 1]; /* Additional amount */
	unsigned char pszField55[FIELD55_SIZE + 1]; /* Additional amount */
	unsigned char pszField56[FIELD56_SIZE + 1]; /* Original data elements */
	unsigned char pszField57[FIELD57_SIZE + 1]; /* Added as ETSL Project needed it (Saritha_b1) */
	unsigned char pszField60[FIELD60_SIZE + 1];  /* Private field 60 */
	unsigned char pszField61[FIELD61_SIZE + 1];  /* Private field 61 */
	unsigned char pszField62[FIELD62_SIZE + 1];  /* Private field 62 */
	unsigned char pszField63[FIELD63_SIZE + 1];  /* Private field 63 */
	unsigned char pszField64[FIELD64_SIZE + 1];  /* MAC */
	unsigned char pszField66[FIELD66_SIZE + 1];  /* Settlement Code */
	unsigned char pszField70[FIELD70_SIZE + 1];  /* Network Management Info Code */
	unsigned char pszField74[FIELD74_SIZE + 1];  /* Number of Refunds */
	unsigned char pszField75[FIELD75_SIZE + 1];  /* Number of Credit reversals */
	unsigned char pszField76[FIELD76_SIZE + 1];  /* Number of Sales */
	unsigned char pszField77[FIELD77_SIZE + 1];  /* Number of Debit reversals */
	unsigned char pszField78[FIELD78_SIZE + 1];  /* Number of Transfers */
	unsigned char pszField79[FIELD79_SIZE + 1];  /* Number of Transfer reversals */
	unsigned char pszField80[FIELD80_SIZE + 1];  /* Number of Inquires */
	unsigned char pszField81[FIELD81_SIZE + 1];  /* Number of Authorizations */
	unsigned char pszField86[FIELD86_SIZE + 1];  /* Total Refund Amount */
	unsigned char pszField87[FIELD87_SIZE + 1];  /* Total Credit Reversal Amount */
	unsigned char pszField88[FIELD88_SIZE + 1];  /* Total Debit Amount */
	unsigned char pszField89[FIELD89_SIZE + 1];  /* Total Debit Reversal Amount */
	unsigned char pszField90[FIELD90_SIZE + 1];  /* Original Elements for Reversal*/
	unsigned char pszField97[FIELD97_SIZE + 1];  /* Net settlement Amount */
	unsigned char pszField118[FIELD118_SIZE + 1];  /* Total number of cash transactions */
	unsigned char pszField119[FIELD119_SIZE + 1];  /* Total amount of cash transacation */
	unsigned char pszField128[FIELD128_SIZE + 1];  /* MAC */

} ISO_DATA;

extern unsigned char pszFieldROC[10];
extern ISO_DATA srISO;

extern field_struct  *field_ptr;

void vdOverLoadISOFDT (int inField, field_struct *srFieldStruct);
void bcd_to_lng (int inDigits);
void lng_to_bcd (int inDigits);
void bcd_to_int (int inDigits);
void int_to_bcd (int inDigits);
void bi3_to_bi3 (int inDigits);
int i_put_len_v2(int n);
unsigned char i_get_asc_to_bcd(void);
void str_to_bf2(int inDigits);
void max_asc_to_bvf(int inDigits);
int inBCD2Int(unsigned char * pstBCD);
unsigned int return_variant1 (void);
unsigned int return_variant2 (void);
int IFLDTBL_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);


extern unsigned char Mti[];
extern unsigned char tpdu[];
extern unsigned char stMap8583[];
extern unsigned char stOptionalMap[];
extern unsigned char stRevFileName[];

extern variant_struct srTempVariant60[];
extern variant_struct srTempVariant63[];
extern variant_struct *psrVariant60;
extern variant_struct *psrVariant63;

typedef variant_struct srVariantStruct;

extern field_struct srBaseIsoFDT[];

extern converters convert_table [];
extern unsigned char src_8583buf[];
extern unsigned char dst_8583buf[];
extern unsigned char *tsrc_8583;
extern unsigned char *tdst_8583;

enum 
{
	FIELD0_P0SITION,
	FIELD1_POSITION,
	FIELD2_POSITION,
	FIELD3_POSITION,
	FIELD4_POSITION,
	FIELD5_POSITION,
	FIELD6_POSITION,
	FIELD7_POSITION,
	FIELD8_POSITION,
	FIELD9_POSITION,
	FIELD10_POSITION,
	FIELD11_POSITION,
	FIELD12_POSITION,
	FIELD13_POSITION,
	FIELD14_POSITION,
	FIELD15_POSITION,
	FIELD17_POSITION,
	FIELD18_POSITION,
	FIELD22_POSITION,
	FIELD23_POSITION,
	FIELD24_POSITION,
	FIELD25_POSITION,
	FIELD26_POSITION,
	FIELD27_POSITION,
	FIELD28_POSITION,
	FIELD30_POSITION,
	FIELD31_POSITION,
	FIELD32_POSITION,
	FIELD33_POSITION,
	FIELD35_POSITION,
	FIELD37_POSITION,
	FIELD38_POSITION,
	FIELD39_POSITION,
	FIELD41_POSITION,
	FIELD42_POSITION,
	FIELD43_POSITION,
	FIELD44_POSITION,
	FIELD45_POSITION,
	FIELD47_POSITION,
	FIELD48_POSITION,
	FIELD52_POSITION,
	FIELD53_POSITION,
	FIELD54_POSITION,
	FIELD55_POSITION,
	FIELD56_POSITION,
	FIELD57_POSITION,
	FIELD60_POSITION,
	FIELD61_POSITION,
	FIELD62_POSITION,
	FIELD63_POSITION,
	FIELD64_POSITION,
	FIELD66_POSITION,
	FIELD70_POSITION,
	FIELD74_POSITION,
	FIELD75_POSITION,
	FIELD76_POSITION,
	FIELD77_POSITION,
	FIELD78_POSITION,
	FIELD79_POSITION,
	FIELD80_POSITION,
	FIELD81_POSITION,
	FIELD86_POSITION,
	FIELD87_POSITION,
	FIELD88_POSITION,
	FIELD89_POSITION,
	FIELD90_POSITION,
	FIELD97_POSITION,
	FIELD118_POSITION,
	FIELD119_POSITION,
	FIELD128_POSITION
};


#endif /* PIP_DEFINED */

#endif /* IFLDTBL */


